import { BaseWindow } from "../../../../component/window/BaseWindow";
import { GTextFormat } from "../../../../common/GTextFormat";
import { ObjCreate } from "../../common/ObjCreate";
import { LoaderManager } from "../../../../../com/gengine/resource/LoaderManager";
import { CopyAccountLabel } from "./CopyAccountLabel";
import { Language } from "../../../../../extend/language/Language";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class CopyRewardsAccountPanel
    
    export  class CopyRewardsAccountPanel extends BaseWindow
    {
        constructor()
        {
            super();
            this.setSize(390, 410);
            this.titleHeight = 43;
            this._tf = new GTextFormat();
            this._tf.font = "黑体";
            this._tf.color = 16772117;
            this._tf.size = 30;
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._bg = new Object /* flash.display.Bitmap */();
            this._bg.x = 7;
            this._bg.y = 42;
            this.addChild(this._bg);
            ObjCreate.createBg(12, 62, 365, 301, this);
            LoaderManager.instance.load("copy_accounts_bg.jpg", this.onLoadComplete);
            this._killedMonstersLabel = new CopyAccountLabel();
            this._killedMonstersLabel.x = 53;
            this._killedMonstersLabel.y = 83;
            this._killedMonstersLabel.addEventListener(CopyAccountLabel.CopyAccount_CountComplete, this.onCountComplete);
            this.addChild(this._killedMonstersLabel);
            this._maxCutsLabel = new CopyAccountLabel();
            this._maxCutsLabel.x = 53;
            this._maxCutsLabel.y = 126;
            this._maxCutsLabel.addEventListener(CopyAccountLabel.CopyAccount_CountComplete, this.onCountComplete);
            this.addChild(this._maxCutsLabel);
            this._scoreLabel = new CopyAccountLabel();
            this._scoreLabel.x = 53;
            this._scoreLabel.y = 169;
            this._scoreLabel.addEventListener(CopyAccountLabel.CopyAccount_CountComplete, this.onCountComplete);
            this.addChild(this._scoreLabel);
            this._rewardsLabel = new CopyAccountLabel();
            this._rewardsLabel.x = 53;
            this._rewardsLabel.y = 212;
            this._rewardsLabel.showUnit = CopyAccountLabel.Coin;
            this._rewardsLabel.addEventListener(CopyAccountLabel.CopyAccount_CountComplete, this.onCountComplete);
            this.addChild(this._rewardsLabel);
            this._rankLabel = ObjCreate.createLabel("", 220, 270, 140, 80, flash.text.TextFormatAlign.LEFT, this);
            this._rankLabel.textField.filters = [new Object /* flash.filters.GlowFilter */(10690304, 1, 2, 2, 10)];
            this._btnOK = ObjCreate.createGButton(Language.getString(69901), 155, 368, 80, 28, this);
            this._btnOK.addEventListener(flash.events.MouseEvent.CLICK, this.onButtonClick);
            return;
        }

        public set rankLabel(arg1: int)
        {
            var loc1=new GTextFormat();
            loc1.font = "黑体";
            loc1.color = 16772117;
            if (arg1 == -1) 
            {
                this._rankLabel.text = Language.getString(60085);
                this._tf.leading = 5;
                this._tf.size = 25;
                this._rankLabel.textField.setTextFormat(this._tf);
                loc1.size = 18;
                this._rankLabel.textField.setTextFormat(loc1, 5, 13);
            }
            else 
            {
                this._rankLabel.text = Language.getStringByParam(60084, String(arg1));
                loc1.size = 22;
                this._rankLabel.textField.setTextFormat(loc1);
                this._rankLabel.textField.setTextFormat(this._tf, 2, 2 + String(arg1).length);
            }
            return;
        }

        public startAccounts(arg1: int, arg2: int, arg3: int, arg4: int, arg5: int): void
        {
            this._killMonsters = arg1;
            this._maxCuts = arg2;
            this._score = arg3;
            this._rewards = arg4;
            this._rank = arg5;
            this._killedMonstersLabel.startCount("copy_accounts_killMonsters.png", this._killMonsters);
            return;
        }

        /* internal  */onCountComplete(arg1: Object /* flash.events.Event */): void
        {
            var loc1=arg1.target;
            switch (loc1) 
            {
                case this._killedMonstersLabel:
                {
                    this._maxCutsLabel.startCount("copy_accounts_maxCuts.png", this._maxCuts);
                    break;
                }
                case this._maxCutsLabel:
                {
                    this._scoreLabel.startCount("copy_accounts_score.png", this._score);
                    break;
                }
                case this._scoreLabel:
                {
                    this._rewardsLabel.startCount("copy_accounts_rewards.png", this._rewards);
                    break;
                }
                case this._rewardsLabel:
                {
                    LoaderManager.instance.load("copy_accounts_rank.swf", this.onLoadComplete);
                    break;
                }
            }
            return;
        }

        /* internal  */onLoadComplete(arg1): void
        {
            var loc1=arg1.name;
            switch (loc1) 
            {
                case "copy_accounts_bg.jpg":
                {
                    this._bg.bitmapData = arg1.bitmapData as Object /* flash.display.BitmapData */;
                    break;
                }
                case "copy_accounts_rank.swf":
                {
                    this._rankMc = arg1.clip as Object /* flash.display.MovieClip */;
                    if (this._rankMc) 
                    {
                        this.startPlayRankMc();
                    }
                    break;
                }
            }
            return;
        }

        /* internal  */startPlayRankMc(): void
        {
            this._rankMc.x = 130;
            this._rankMc.y = 290;
            this._rankMc.scaleX = 0.8;
            this._rankMc.scaleY = 0.8;
            this._rankMc.addEventListener(flash.events.Event.ENTER_FRAME, this.onEnterFrameHandler);
            this.addChild(this._rankMc);
            this._rankMc.play();
            return;
        }

        /* internal  */onEnterFrameHandler(arg1: Object /* flash.events.Event */): void
        {
            if (this._rankMc.currentFrame == 30) 
            {
                this._rankMc.gotoAndStop(this._rankMc.totalFrames);
                this._rankMc.removeEventListener(flash.events.Event.ENTER_FRAME, this.onEnterFrameHandler);
                this.rankLabel = this._rank;
            }
            return;
        }

        /* internal  */onButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        /* internal */ /* var */_tf: Object /* flash.text.TextFormat */;

        /* internal */ /* var */_killMonsters: int;

        /* internal */ /* var */_maxCuts: int;

        /* internal */ /* var */_score: int;

        /* internal */ /* var */_rewards: int;

        /* internal */ /* var */_rank: int;

        /* internal */ /* var */_bg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_killedMonstersLabel: CopyAccountLabel;

        /* internal */ /* var */_maxCutsLabel: CopyAccountLabel;

        /* internal */ /* var */_scoreLabel: CopyAccountLabel;

        /* internal */ /* var */_rewardsLabel: CopyAccountLabel;

        /* internal */ /* var */_rankMc: Object /* flash.display.MovieClip */;

        /* internal */ /* var */_rankLabel: GLabel;

        /* internal */ /* var */_btnOK: GButton;
    }
